const express = require('express');
const router = new express.Router();

/**
 * @param {Object} options
 * @param {} options.dealerId 总代Id
 * @param {} options.brandId 品牌Id
 * @param {} options.code 编号
 * @param {} options.partContractInvoiceCode 备件箱单发票编号
 * @param {} options.priceTerms 价格条款  1-FOB  2-CFR  3-CIF  4-FCA  5-CPT  6-CIP  7-EXW
 * @param {} options.forwarder 货代名称
 * @param {} options.pageSize 每页数据量
 * @param {} options.pageIndex 指定页
 * @param {} options.sortField 排序字段
 * @param {} options.isDesc 倒序排列
 * @throws {Error}
 * @return {Promise}
 */
router.get('/', async(req, res, next) => {
    const options = {
        dealerId: req.query.dealerId,
        brandId: req.query.brandId,
        code: req.query.code,
        partContractInvoiceCode: req.query.partContractInvoiceCode,
        priceTerms: req.query.priceTerms,
        forwarder: req.query.forwarder,
        pageSize: req.query.pageSize,
        pageIndex: req.query.pageIndex,
        sortField: req.query.sortField,
        isDesc: req.query.isDesc
    };
    const data = {
        message: 'message',
        payload: {
            content: [
                {
                    id: 'id53',
                    partShipmentId: 'partShipmentId54',
                    brandCode: 'brandCode55',
                    dealerCode: 'dealerCode56',
                    code: 'code57',
                    partContractInvoiceCode: 'partContractInvoiceCode58',
                    priceTerms: 1,
                    importerCantact: 'importerCantact',
                    forwarder: 'forwarder',
                    loadingPort: 'loadingPort',
                    destinationPort: 'destinationPort',
                    dischargePort: 'dischargePort',
                    shippingFee: 1,
                    createTime: '2019-09-05T05:56:17Z',
                    options: [
                        'update',
                        'ship'
                    ]
                },
                {
                    id: 'id59',
                    partShipmentId: 'partShipmentId60',
                    brandCode: 'brandCode61',
                    dealerCode: 'dealerCode62',
                    code: 'code63',
                    partContractInvoiceCode: 'partContractInvoiceCode64',
                    priceTerms: 1,
                    importerCantact: 'importerCantact',
                    forwarder: 'forwarder',
                    loadingPort: 'loadingPort',
                    destinationPort: 'destinationPort',
                    dischargePort: 'dischargePort',
                    shippingFee: 1,
                    createTime: '2019-09-05T05:56:17Z',
                    options: [
                        'update',
                        'ship'
                    ]
                }
            ],
            pageIndex: null,
            pageSize: null,
            sort: null,
            totalElements: 50,
            totalPages: null
        }
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @throws {Error}
 * @return {Promise}
 */
router.post('/', async(req, res, next) => {
    const options = {
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id id
 * @throws {Error}
 * @return {Promise}
 */
router.get('/:id', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message',
        payload: {
            id: 'id65',
            code: 'code66',
            branchCode: 'branchCode67',
            branchName: 'branchName68',
            brandId: 'brandId69',
            brandCode: 'brandCode70',
            brandName: 'brandName71',
            dealerCode: 'dealerCode72',
            dealerName: 'dealerName73',
            partContractInvoiceCode: 'partContractInvoiceCode74',
            exporter: 'exporter',
            importer: 'importer',
            loadingPort: 'loadingPort',
            destinationPort: 'destinationPort',
            priceTerms: 1,
            shippingFee: 1,
            carrier: 'carrier',
            importerCantact: 'importerCantact',
            importerNumber: 'importerNumber',
            contactEmail: 'contactEmail',
            contactFax: 'contactFax',
            notifyParty: 'notifyParty',
            forwarder: 'forwarder',
            forwarderContact: 'forwarderContact',
            forwarderNumber: 'forwarderNumber',
            forwarderFax: 'forwarderFax',
            dischargePort: 'dischargePort',
            remark: 'remark',
            shippingMark: 'shippingMark',
            companySeal: 'https://wiki.sdtdev.net/%E6%96%87%E4%BB%B6:CHERYINTL-%E5%A4%87%E4%BB%B6%E8%B4%A7%E8%BF%90%E5%A7%94%E6%89%98%E4%B9%A6%E7%AE%A1%E7%90%86-DCSPart-%E7%94%B5%E5%AD%90%E7%AB%A0.jpg',
            description: 'description',
            createTime: '2019-09-05T05:56:17Z',
            partShipmentId: 'partShipmentId54',
            rowVersion: 'rowVersion',
            options: [
                'update',
                'ship'
            ],
            volumeTotal: 1,
            packingListTotal: 1,
            grossWeightTotal: 1
        }
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id Id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
module.exports = router;
